package com.zer0.tga.entity.unit;

import com.zer0.tga.entity.Entity;

public class Unit extends Entity{

	public enum UnitType{ FRIENDLY, ENEMY, NEUTRAL } 
	public UnitType unitType;
	
	public boolean invincible = false;
	
	public double movementSpeed = 1.0;

	public int maxHealth = 100;
	public int health = maxHealth;
	
	public int hurtTime;
	public int pushback;
	
	
	public void tick()
	{
		if (hurtTime > 0) {
			hurtTime--;
			invincible = true;
		}
		
		if(health <= 0)
		{	
			die();
			this.removed=true;
		}
		
	}
	
	public void setStartHealth(int hp) {
		maxHealth = health = hp;
	}
	
	public void hurt(int damage)
	{
		if (invincible)
			return;
		
		health-=damage;
		hurtTime=20;
	}
	
	public void hurt()
	{
		hurt(1);
	}
	
	public void die()
	{
		
	}
	
}
